package com.rc.saas.tenant.service.ticket;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.rc.saas.tenant.mapper.ticket.TenantTicketSendRecordMapper;
import com.rc.saas.tenant.model.ticket.TenantTicketSendRecord;
import com.rc.saas.tenant.search.ticket.TicketSendRecordSearch;
import com.rc.saas.tenant.vo.ticket.TicketSendRecordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author frog
 * @date 2021/5/8
 */
@Service
public class TenantTicketSendRecordServiceImpl implements TenantTicketSendRecordService {

    @Autowired
    private TenantTicketSendRecordMapper tenantTicketSendRecordMapper;

    @Override
    public TenantTicketSendRecordMapper getMapper() {
        return tenantTicketSendRecordMapper;
    }

    @Override
    public PageInfo<TicketSendRecordVo> listPageSendRecord(TicketSendRecordSearch ticketSendRecordSearch) {
        PageHelper.startPage(ticketSendRecordSearch.getOffset(), ticketSendRecordSearch.getLimit());
        List<TicketSendRecordVo> sendRecordVoList = tenantTicketSendRecordMapper.listPageSendRecord(ticketSendRecordSearch);
        return new PageInfo<TicketSendRecordVo>(sendRecordVoList);
    }

    @Override
    public Long insertReturnId(TenantTicketSendRecord tenantTicketSendRecord) {
        return tenantTicketSendRecordMapper.insertReturnId(tenantTicketSendRecord);
    }
}
